package ud13.ventanas4;

import java.awt.Toolkit;
import java.util.Scanner;

import javax.swing.JFrame;

@SuppressWarnings("serial")
public class Main extends JFrame {
	int tAncho;
	int tAlto;
	
	private void inicializar() {
		int anchoPantalla=Toolkit.getDefaultToolkit().getScreenSize().width;
		int altoPantalla=Toolkit.getDefaultToolkit().getScreenSize().height;
		tAncho=200;
		tAlto=200;
		setSize(tAncho, tAlto);
		setLocation(anchoPantalla/2-tAncho/2, altoPantalla/2-tAlto/2);
		setTitle("Ejercicio 04");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		
	}
	
	private void esperar() {
		for (int i = 0; i<100000; i++) {
			for (@SuppressWarnings("unused")
			int j=0; i<10000000; i++) {
				
			}
		}
	}
	
	public Main() {
		inicializar();
		mover();
	}
	
	private void mover() {
		int x = this.getLocation().x;
		int y = this.getLocation().y;
		
		for (int i = 0; i<200; i++) {
			setLocation(x+i, y);
			setSize(100+i, 400);
			esperar();
		}
	}

	public static void main(String[] args) {
		new Main();
	}
	
	@SuppressWarnings("unused")
	private static String getTitulo() {
		String sol="";
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		System.out.println("Dime un titulo para tu ventana: ");
		sol=scan.nextLine();
		return sol;
	}
}
